package com.glela.packet.enums;

import org.apache.commons.lang3.StringUtils;

public enum RedPacketEventTypeEnum {

    SYSTEM_GIVE("system_give", "系统赠送", "SY"),
    INVITING_FIRST_ORDER("inviting_first_order", "邀请新用户店主奖励", "FO"),
    NEW_STORE_OWNER_AWARD("new_store_owner_award", "新店主获得奖励", "NS"),
    OLD_STORE_OWNER("old_store_owner", "老店主获得奖励", "OS"),
    LIVE_SHARE_AWARD("live_share_award", "直播间分享奖励", "LS"),
    SHARE_PRODUCT_LIVE_ORDER_USER_AWARD("share_product_live_order_user_award","分享产品下单成功奖励下单人","SU"),
    SHARE_PRODUCT_LIVE_ORDER_STORE_AWARD("share_product_live_order_store_award","分享产品下单成功奖励店主","SS");

    private String type;

    private String desc;

    private String prefix;

    RedPacketEventTypeEnum(String type, String desc, String prefix) {
        this.type = type;
        this.desc = desc;
        this.prefix = prefix;
    }

    public static RedPacketEventTypeEnum getByType(final String type) {
        if (StringUtils.isBlank(type)) {
            return null;
        }
        for (RedPacketEventTypeEnum typeEnum : RedPacketEventTypeEnum.values()) {
            if (typeEnum.getType().equals(type)) {
                return typeEnum;
            }
        }

        return null;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    @Override
    public String toString() {
        return "RedPacketEventTypeEnum{" +
                "type='" + type + '\'' +
                ", desc='" + desc + '\'' +
                ", prefix='" + prefix + '\'' +
                '}';
    }
}
